package cn.bonoon.kernel.web.html.form;

import cn.bonoon.kernel.web.EmbedType;
import cn.bonoon.kernel.web.annotations.form.InsertCell;
import cn.bonoon.kernel.web.html.FormSetting;
import cn.bonoon.kernel.web.html.UIPropertyBuilder;

public class PropertySimpleParser extends AbstractPropertyParser<FormSetting> {

	private final String value;
	private final EmbedType type;

	public PropertySimpleParser(FormSetting reader, InsertCell component) {
		super(reader);
		this.ordinal = component.ordinal();
		this.colspan = component.colspan();
		this.name = component.name();
		this.value = component.value();
		this.type = component.type();
		this.showHead = !this.name.isEmpty();
	}

	@Override
	protected void buildContent(UIPropertyBuilder pb) {
		type.parse(pb.getInitHtml(), value);
	}
}
